package com.ganzi.ganziitem.netty;

import com.ganzi.ganziitem.rabbit.SendUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

@Component
public class NettyStart implements CommandLineRunner {

    private static Logger log = LoggerFactory.getLogger(NettyStart.class);

    @Autowired
    NettyServerListener nettyServerListener;
    @Autowired
    SendUtil senUtil;

    /**
     * springboot启动完成后会执行这个方法
     * */
    @Override
    public void run(String... args) throws Exception {
        log.info("服务端启动netty---------");
        senUtil.sendStateToServer(null,1,2);//学校在线
        nettyServerListener.start();

    }
}
